load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")
load("@fbsource//tools/build_defs:rust_unittest.bzl", "rust_unittest")

oncall("scm_server_infra")

rust_library(
    name = "restricted_paths",
    srcs = glob([
        "src/**/*.rs",
        "schemas/**/*.sql",
    ]),
    test_deps = [
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/common/sql_construct:sql_construct",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:derivative",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:hex",
        "fbsource//third-party/rust:smallvec",
        "fbsource//third-party/rust:strum",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/shed/sql:sql",
        "//eden/mononoke/common/path_hash:path_hash",
        "//eden/mononoke/common/rust/sql_ext:sql_ext",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/common/sql_construct:sql_construct",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/permission_checker:permission_checker",
        "//eden/mononoke/server/context:context",
    ],
)

rust_unittest(
    name = "restricted_paths_test",
    srcs = glob(["test/**/*.rs"]),
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:pretty_assertions",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:tempfile",
        "fbsource//third-party/rust:tokio",
        ":restricted_paths",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/common/metadata:metadata",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/common/sql_construct:sql_construct",
        "//eden/mononoke/derived_data:fsnodes",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_api:mononoke_api",
        "//eden/mononoke/mononoke_api_hg:mononoke_api_hg",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/permission_checker:permission_checker",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/tests/utils:tests_utils",
        "//eden/scm/lib/clientinfo:clientinfo",
    ],
)
